function drawK(chartDom, dates, datas, buySell, markLine, volumes, l5, l10, l20) {
	let myChart;
	myChart = echarts.init(chartDom);
	option = {
		title: {
			left: 'left',
			text: "日K"
		},
		grid: {
			left: '3%',
			right: '14%',
			bottom: '3%',
			containLabel: true
		},
		type: "candlestick",
		legend: {
			selected: {
				Volume: false
			}
		},
		tooltip: {
			trigger: 'axis',
			axisPointer: {
				type: 'cross'
			}
		},
		xAxis: {
			data: dates
		},
		yAxis: {
			scale: true,

		},
		dataZoom: [{
				textStyle: {
					color: '#8392A5'
				},
				handleIcon: 'path://M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
				dataBackground: {
					areaStyle: {
						color: '#8392A5'
					},
					lineStyle: {
						opacity: 0.8,
						color: '#8392A5'
					}
				},
				brushSelect: true
			},
			{
				type: 'inside'
			}
		],
		series: [{
				markLine: {
					data: markLine,
					silent: true
				},
				type: 'k',
				data: datas,
				markPoint: {
					symbolSize: 90,
					itemStyle: {
						normal: {
							label: {
								show: true,
								color: '#ffffff', //气泡中字体颜色
							}
						}
					},
					data: buySell
				},
			},
			{
				name: 'Volume',
				type: 'bar',
				data: volumes
			}, {
				name: 'l5',
				type: 'line',
				data: l5
			}, {
				name: 'l10',
				type: 'line',
				data: l10
			}, {
				name: 'l20',
				type: 'line',
				data: l20
			}

		]
	};

	myChart.setOption(option);
}

function drawLineDgls(dates, list, chartDom) {
	let myChart;
	myChart = echarts.init(chartDom);
	let option = {
		grid: {
			left: '3%',
			right: '14%',
			bottom: '3%',
			containLabel: true
		},
		tooltip: {
			trigger: 'axis',
			axisPointer: {
				type: 'cross'
			}
		},
		xAxis: {
			type: 'category',
			data: dates
		},
		yAxis: {
			type: 'value'
		},
		series: [{
			data: list,
			type: 'line'
		}]
	};
	myChart.setOption(option);
}

function drawKDJLines(dates, k, d, j, chartDom,markPoints) {
	let myChart;
	myChart = echarts.init(chartDom);
	let option = {
		grid: {
			left: '3%',
			right: '14%',
			bottom: '3%',
			containLabel: true
		},
		tooltip: {
			trigger: 'axis',
			axisPointer: {
				type: 'cross'
			}
		},
		xAxis: {
			type: 'category',
			data: dates
		},
		yAxis: {
			type: 'value'
		},
		series: [{
				name: "k",
				type: "line",
				data: k
			},
			{
				name: "d",
				type: "line",
				data: d
			},
			{
				name: "j",
				type: "line",
				data: j,
				markPoint: {
									symbolSize: 90,
									itemStyle: {
										normal: {
											label: {
												show: true,
												color: '#ffffff', //气泡中字体颜色
											}
										}
									},
									data:markPoints
								},
			},
		]
	};
	myChart.setOption(option);
}

var chartDom2;
var myChart2;

function drawYear(years, list) {
	if (!chartDom2) {

		chartDom2 = document.getElementById('main2');
		myChart2 = echarts.init(chartDom2);
	}
	myChart2.clear();
	var months = [];
	for (var i = 0; i < 12; i++) {
		months.push((i + 1) + "月");
	}
	option2 = {
		title: {
			text: app.$data.selItem.name + "每月收盘"
		},
		tooltip: {
			trigger: 'axis'
		},
		legend: {
			data: years
		},
		grid: {
			left: '3%',
			right: '4%',
			bottom: '3%',
			containLabel: true
		},

		xAxis: {
			type: 'category',
			boundaryGap: false,
			data: months
		},
		yAxis: {
			type: 'value'
		},
		series: list
	};
	myChart2.setOption(option2);
}

var chartDom3;
var myChart3;

function drawGU(dates, closeList, ma5, ma10, ma20, ma60, macd, dealPower, volMa5, volMa10, colorBar) {
	var buySell = [];
	for (let i = 0; i < dates.length; i++) {
		let tempDate2 = dates[i];
		objList[app.$data.selItem.code].deals.forEach(item => {
			let tempDate = item.date.replace("-", "").replace("-", "").substr(2, 6);
			if (tempDate2 == tempDate) {
				var node = {};
				node.name = item.deal > 0 ? "买" : "卖";
				node.value = item.deal > 0 ? "买" : "卖";
				node.value = node.value + item.deal + "\n" + item.price;
				node.xAxis = i;
				node.yAxis = item.price;
				node.itemStyle = {
					color: item.deal > 0 ? "red" : "green"
				}
				buySell.push(node);
			}
		});
	}

	if (!chartDom3) {

		chartDom3 = document.getElementById('main1');
		myChart3 = echarts.init(chartDom3);
	}
	myChart3.clear();


	option2 = {
		title: {

		},
		tooltip: {
			trigger: 'axis'
		},
		legend: {
			selected: {
				'Vol': false,
				volMa5: false,
				volMa10: false,
			}
		},

		xAxis: {
			type: 'category',
			boundaryGap: false,
			data: dates
		},
		yAxis: {
			type: 'value',

		},
		series: [{
				name: app.$data.selItem.name,
				type: 'line',
				data: closeList,
				smooth: true,
				lineStyle: {
					width: 1
				},
				markPoint: {
					symbolSize: 90,

					itemStyle: {
						normal: {

							label: {
								show: true,
								color: '#ffffff', //气泡中字体颜色
							}
						}
					},
					data: buySell
				},
			},
			{

				name: "MA5",
				lineStyle: {
					width: 0.5
				},
				type: 'line',
				data: ma5,
				symbol: 'none',
			},
			{
				name: "MA10",
				lineStyle: {
					width: 0.8
				},
				type: 'line',
				data: ma10,
				symbol: 'none',
			},
			{
				name: "MA20",
				lineStyle: {
					width: 1
				},
				type: 'line',
				data: ma20,
				symbol: 'none',
			},
			{
				name: "MA60",
				lineStyle: {
					width: 1.1
				},
				type: 'line',
				data: ma60,
				symbol: 'none',
			},
			{
				name: "dif",
				lineStyle: {
					width: 1.1
				},
				type: 'line',
				data: macd.dif,
				symbol: 'none',
			},
			{
				name: "dea",
				lineStyle: {
					width: 1.1
				},
				type: 'line',
				data: macd.dea,

				symbol: 'none',
			},
			{
				name: "macd",
				lineStyle: {
					width: 1.1
				},
				type: 'bar',
				data: macd.macd,
				symbol: 'none',
				itemStyle: {
					normal: {
						color: function(pars) {
							return pars.value > 0 ? "red" : "green";
						}
					}
				}
			},
			{
				name: "Vol",
				lineStyle: {
					width: 1.1
				},
				type: 'bar',
				data: dealPower,
				symbol: 'none',
				showAllSymbol: false,
				itemStyle: {
					normal: {
						color: function(pars) {
							return colorBar[pars.dataIndex]
						}
					}
				}
			},
			{
				name: "volMa5",
				lineStyle: {
					width: 1.1
				},
				type: 'line',
				data: volMa5,
				symbol: 'none',
			},
			{
				name: "volMa10",
				lineStyle: {
					width: 1.1
				},
				type: 'line',
				data: volMa10,
				symbol: 'none',
			},
		]
	};
	myChart3.setOption(option2);
}
